package com.medusa.aps.business.modules.modeling.model.input;

import com.medusa.aps.business.model.constant.RegexPool;
import com.medusa.aps.business.model.enums.AuxiliaryEnum;
import com.medusa.aps.business.model.enums.AuxiliaryStatus;
import com.medusa.aps.business.model.enums.SourceEnum;
import com.medusa.aps.business.modules.modeling.mp.entity.AuxiliaryData;
import com.medusa.aps.business.common.web.valid.group.Update;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class AuxiliaryDataDTO {

    /**
     * 主键
     */
    @Schema(description = "主键")
    @NotNull(groups = Update.class)
    private Integer id;
    /**
     * 辅助资源编码
     */
    @Schema(description = "辅助资源编码")
    @Size(max = 50, message = "辅助资源编码长度不能超过50")
    @NotBlank(message = "辅助资源编码不能为空")
    @Pattern(regexp = RegexPool.ORDER_NO, message = "辅助资源编码只支持数字、字母、符号")
    private String auxiliaryResourceCoding;

    /**
     * 辅助资源名称
     */
    @Schema(description = "辅助资源名称")
    @Size(max = 50, message = "辅助资源名称长度不能超过50")
    @NotBlank(message = "辅助资源名称不能为空")
    private String auxiliaryResourceName;


    /**
     * 类型
     */
    @Schema(description = "类型")
    @NotNull(message = "类型不能为空")
    private AuxiliaryEnum type;

    /**
     * 状态
     */
    @Schema(description = "状态")
    private AuxiliaryStatus status;
    /**
     * 描述
     */
    @Schema(description = "描述")
    private String description;


    public AuxiliaryData newAuxiliaryData() {
        return new AuxiliaryData()
                .setId(id)
                .setAuxiliaryResourceCoding(auxiliaryResourceCoding)
                .setAuxiliaryResourceName(auxiliaryResourceName)
                .setType(type)
                .setStatus(status)
                .setDescription(description)
                .setDataSource(SourceEnum.ARTIFICIAL);
    }
}
